package com.api.mc
{
	import com.api.StaticData;
	import com.game.utils.MyTimer;
	
	import flash.display.MovieClip;
	import flash.text.TextField;
	
	public class MatchPlayer extends MovieClip
	{
		//swf资源
		public var timeTxt:TextField;
		public var clewTxt:TextField;
		
		private var _myTimer:MyTimer;
		private var _waitTime:int=10;
		private var _fun:Function;
		public function MatchPlayer(fun:Function)
		{
			_fun=fun;
			
		
			init()
		}
		private function init():void{
			_waitTime=StaticData.config.matchTime;
			_myTimer=new MyTimer();
			runTime();
			_myTimer.setTimer(runTime,1*1000);
		}
		private function runTime():void{
			timeTxt.text="倒计时: "+_waitTime+" 秒"
			_waitTime--;
			if(_waitTime==-1){
				_fun();
				if(_myTimer!=null){
					_myTimer.gc();
				}
				
			}
		}
		public function gc():void{
			if(_myTimer!=null){
				_myTimer.gc();
			}
			_myTimer=null;
			_fun=null;
		}
		
	}
}